#include <iostream>
#include <queue>
#include <map>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <cstring>
#include <set>
#include <unordered_set>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
const int N=1e6+10;
int prime[N];
int v[N];
int main()
{
	for (int i = 2,m=0; i<=1000000; i++) {
	if (v[i] == 0) { 
		v[i] = i;
		prime[++m] = i;
	}
	for (int j = 1; j <= m; j++) {
		if (prime[j] > v[i] || prime[j] > 1000000/i) break;
		v[i*prime[j]] = prime[j];
	}
    }

	int t;
	cin>>t;
	while(t--)
	{
		int n,m;
		cin>>n>>m;
		int m1=min(m,n/2);
		if((v[n]==n || v[n]>m1) && n>m || n==1) cout<<"yes";
		else cout<<"no";
		cout<<endl;
	}

	return 0;
}

